<template>
    <div class="shop_page">
      <h3>在线商城链接编辑</h3>
        <el-form ref="form" :model="form" label-width="100px" style="width:800px">
            <el-form-item label="链接地址编辑">
                <el-input v-model="form.url" placeholder="输入链接网址"></el-input>
            </el-form-item>
        </el-form>
        <el-button type="primary" @click="commit_it()">确定提交</el-button>
    </div>
</template>
<script>
import g from '../../components/global.js'
export default {
  data() {
    return {
      form: {
        url: ''
      }
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    commit_it() {
      var _this = this
      $.ajax({
        type: 'POST',
        url: g.res_url + '/api/v1/shop_online_savedata',
        data: {
          content: _this.form.url
        },
        success: function(data) {
          if (data == 'success') {
            _this.$message.success('操作成功')
          } else {
            _this.$message.error('操作失败')
          }
        },
        error: function() {
          _this.$message.error('网络繁忙！')
        }
      })
    },
    getData() {
      var _this = this
      $.ajax({
        type: 'POST',
        url: g.res_url + '/api/v1/shop_online_getdata',
        data: null,
        success: function(data) {
          _this.form.url = data
        },
        error: function() {
          _this.$message.error('网络繁忙！')
        }
      })
    }
  }
}
</script>

